package com.ten.system.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ten.common.core.entity.AclRole;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author ：Q大侠
 * @date ：Created in 2022/12/5 14:48
 * @description：
 * @modified By：
 * @version:
 */
public interface AclRoleDao extends BaseMapper<AclRole> {
    @Select(value = "select distinct r.* from acl_role r " +
                    "join acl_user_role ur on r.id=ur.role_id " +
                    "where ur.user_id=#{userid}")
    List<AclRole> selectByUserid(Long userid);
    /** 
     * @create by:  Q大侠
     * @description:  角色禁用/启用 
     * @create time: 2022/12/10 19:21
     * @param  id,deleted 
     * @return  Result 
     */
    @Update(value = "update acl_role set is_deleted=#{deleted} where id=#{id}")
    int updateRoleStatusByid(String id, Integer deleted);
}
